package com.zhuang.nio.c1;

import java.nio.ByteBuffer;

/**
 * description: TestByteBufferAllocate
 * date: 2022/12/12 10:10
 * author: Zhuang
 * version: 1.0
 */
public class TestByteBufferAllocate {
    public static void main(String[] args) {
        System.out.println("ByteBuffer.allocate(16).getClass() = " + ByteBuffer.allocate(16).getClass());
        System.out.println("ByteBuffer.allocateDirect(16).getClass() = " + ByteBuffer.allocateDirect(16).getClass());
        /*
        class java.nio.HeapByteBuffer    - java 堆内存，读写效率较低，受到 GC 的影响
        class java.nio.DirectByteBuffer  - 直接内存，读写效率高（少一次拷贝），不会受 GC 影响，分配的效率低
         */
    }
}
